#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>

inline google::protobuf::Message* CreateMsg(const std::string& type_name)
{
	google::protobuf::Message* msg = NULL;
	const google::protobuf::Descriptor* dsc = google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName(type_name);
	if (dsc) {
		const google::protobuf::Message* type = google::protobuf::MessageFactory::generated_factory()->GetPrototype(dsc);
		if (type){
			msg = type->New();
		}
	}

	return msg;
}